import fetch from 'utils/fetch';
// 获取app班级树状图


export function getClassTree(schoolId) {
    const data = {
        schoolId,
    };
    return fetch({
        url: '/schoolNews/getClassTree',
        method: 'post',
        data
    });
}


// 获取班牌班级树状图

export function getWisdomClassTree(schoolId) {
    const data = {
        schoolId,
    };
    return fetch({
        url: '/schoolNews/getWisdomClassTree',
        method: 'post',
        data
    });
}



// 6. 学校通知列表
export function listSchoolNews(curPage, pageSize, schoolId, name, status, creator) {
    const data = {
        curPage,
        pageSize,
        schoolId,
        name,
        status,
        creator
    };
    return fetch({
        url: '/schoolNews/listSchoolNews',
        method: 'post',
        data
    });
}

// 删除
export function batchRemoveSchoolNews(id) {
    const data = {
        id //通知Id，多个已逗号隔开 必填",
    };
    return fetch({
        url: '/schoolNews/batchRemoveSchoolNews',
        method: 'post',
        data
    });
}
// // 4. 通知上线和下线
// export function updateNewsStatus(id,status,schoolId) {
//     const data = {
//         id,//通知Id，多个已逗号隔开 必填",
//         status,//0代表下线  1代表上线
//         schoolId
//     };
//     return fetch({
//         url: '/schoolNews/updateNewsStatus',
//         method: 'post',
//         data
//     });
// }
// 4. 通知上线
export function onLine(id, status, schoolId,classId) {
    const data = {
        id, //通知Id，多个已逗号隔开 必填",
        status, //0代表下线  1代表上线
        schoolId,
        classId
    };
    return fetch({
        url: '/schoolNews/updateNewsStatus',
        method: 'post',
        data
    });
}
// 4. 通知下线
export function downLine(id, status, schoolId,classId) {
    const data = {
        id, //通知Id，多个已逗号隔开 必填",
        status, //0代表下线  1代表上线
        schoolId,
        classId
    };
    return fetch({
        url: '/schoolNews/updateNewsStatus',
        method: 'post',
        data
    });
}
// 2. 查询学校通知
export function getSchoolNewsById(json) {
    const data = {
        ...json, //通知Id必填",
    };
    return fetch({
        url: '/schoolNews/getSchoolNewsById',
        method: 'post',
        data
    });
}
// 3. 编辑学校通知
export function updateSchoolNews(listClassId,
    classIdList,
    startTime,
    endTime,
    same,id, schoolId, name, pic, content, stick) {
    const data = {
        listClassId,
        classIdList,
        startTime,
        endTime,
        same,
        id, //通知Id必填",
        schoolId,
        name,
        pic,
        content,
        stick
    };
    return fetch({
        url: '/schoolNews/updateSchoolNews',
        method: 'post',
        data
    });
}
// {"listClassId":["2890a54b-4ecf-424e-9c3f-369078b3f35c","5e832857-1c05-4845-9947-23c94c27a4f2"],
// "classIdList":["19152ec4-7060-422d-9661-2b381ead932d","2478022c-a187-473d-ac37-0de976bf3a46",],
// "startTime":"2018-06-29 20:00:00",
// "endTime":"2018-06-29 22:00:00",
// "name":"嗯",
// "pic":"",
// "content":"好地方",
// "stick":"0",
// "same":"0",
// "schoolId":"0dc6f0eb-fd58-4d48-ab2b-e3ca23228620"}
// 3. 添加学校通知
export function saveSchoolNews( listClassId,classIdList,startTime,endTime,same,schoolId, name, pic, content, stick) {
    const data = {
        listClassId,
        classIdList,
        startTime,
        endTime,
        same,
        schoolId,
        name,
        pic,
        content,
        stick
    };
    return fetch({
        url: '/schoolNews/saveSchoolNews',
        method: 'post',
        data
    });
}